package com.fxu.tpl.enums;

import com.fxu.framework.core.enums.BaseEnum;
import lombok.AllArgsConstructor;

/***
 * <p>yuye</p>
 * 日志记录表：[log_track]的数据实体枚举类
 * @author fangxu
 * @version 2022-03-11
 ***/
@AllArgsConstructor
public enum LogTrackTypeEnum implements BaseEnum<String, String> {
    INFO("INFO", "信息"),
    WARN("WARN", "警告"),
    ERROR("ERROR", "异常"),
    ;

    String code;
    String desc;

    @Override
    public String code() {
        return code;
    }

    @Override
    public String desc() {
        return desc;
    }

    public static String desc(String code) {
        LogTrackTypeEnum ret = find(code);
        return ret == null ? null : ret.desc;
    }

    public static LogTrackTypeEnum find(String code) {
        return code == null ? null : BaseEnum.findOne(values(), v -> v.code.equals(code));
    }
}